﻿<%@ Control Language="C#" AutoEventWireup="true" Inherits="BeiXun.Shared.UserControls.Copyright"
    CodeFile="Copyright.ascx.cs" %>
<div id="demo" style="overflow: hidden; width: 600px; float: left; color: Blue;">
    <table cellspacing="0" cellpadding="0" align="left" border="0" cellspace="0">
        <tbody>
            <tr>
                <td id="demo1" valign="top">
                    <table width="500" style="height:25px" border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <asp:Literal ID="litHtml" runat="server" meta:resourcekey="litHtmlResource1"></asp:Literal></tr>                         
                    </table>
                </td>
                <td id="demo2" valign="top">
                    &nbsp;
                </td>
            </tr>
        </tbody>
    </table>
</div>
<div><span id="CheckSystem" runat="server"></span> &nbsp;&nbsp;<asp:Label ID="lblNewAlarm" runat="server" Text="最新告警：" meta:resourcekey="lblNewAlarmResource1"></asp:Label><a href="../../Modules/Ericsson/UcLogSysAlarmList.aspx" style="text-decoration:none;" ><span id="result" runat="server" style="width:100px; overflow:hidden; color: red;"></span></a></div>


<script type="text/javascript" language="JavaScript" charset="gb2312"> 
    window.setInterval("getSystemStatus()", 6000);
    window.setInterval("getWarningMessage()", 6000);
   
    function getSystemStatus() {
        var myDateTime = new Date();
        var nowTime = myDateTime.getTime();

        var returnText = getResponseText("../../DataRequest.aspx?page=CheckSystem&nowTime=" + nowTime); 
        if (returnText == "0" || returnText == null || returnText == "undefined") {//do nothing     
        }
        else {
          document.getElementById('<%= CheckSystem.ClientID %>').innerText=returnText;
        }
    }
    
    function getWarningMessage() {
    var myDateTime = new Date();
    var nowTime = myDateTime.getTime();

    var returnText = getResponseText("../../DataRequest.aspx?page=GetAlarm&nowTime=" + nowTime); 
    if (returnText == "0" || returnText == null || returnText == "undefined") {//do nothing     
    }
    else {
      document.getElementById('<%= result.ClientID %>').innerText=returnText;
      //document.getElementById("result").=returnText;
      //alert("getWarningMessage" + returnText);

        }
    }

    //获取返回的Ajax字符串

    //url:调用urlstr获得返回字符串

    function getResponseText(urlstr) {
        var xmlDoc = null;
        try {
            var http_request = false;
            http_request = initAjax();
            http_request.onreadystatechange = function () {
                if (http_request.readyState == 4) {
                    xmlDoc = http_request.responseText;
                }
            }
            http_request.open("GET", urlstr, false);
            http_request.send(null);
        } catch (ex1) {
            xmlDoc = null;
        }
        return xmlDoc;
    }

    //返回ajax的Request对象
    function initAjax() {

        var ajax_request = false; //把false优化为null?
        try {
            ajax_request = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (ex) {
            try {
                ajax_request = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (ex) {
                ajax_request = false;
            }
        }
        if (!ajax_request && typeof XMLHttpRequest != 'undefined') {
            ajax_request = new XMLHttpRequest();
        }
        return ajax_request;
    }
</script>
